'use strict';

var charityApp = angular.module('charityApp', ['ui.bootstrap','textAngular', 'ui.router', 
    'chieffancypants.loadingBar', 'charityDonate.controller','user.service','user.controller',
    'resetPassword.service','resetPassword.controller',
    'charitySociety.service', 'charityProject.service', 'charitySociety.controller', 'charityFoundation.controller', 
    'media.controller', 'home.controller', 'project.controller','donation.controller','tinyLove.controller','happyLive.controller','weixinpay.controller','paynotify.controller',
    'app.nav','audit.controller','audit.service']);

var GLOBAL_SESSION = "SY_CHARITY";
charityApp.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {

    $.context.open(GLOBAL_SESSION);
    $urlRouterProvider.otherwise('/');
    $stateProvider.state('home', {
        url: '/',
        controller: 'homeController',
        templateUrl: 'views/home.html'
    }).state('error', {
        url: '/error',
        templateUrl: 'views/error.html'
    }).state('charitySociety', {
        url: '/charitySociety',
        controller: 'charitySocietyController',
        templateUrl: 'app/society/charitySociety.html',
        params: {articleType: ''}
    }).state('charityFoundation', {
        url: '/charityFoundation',
        controller: 'charityFoundationCtrl',
        templateUrl: 'app/foundation/charity-foundation.html',
        params: {articleType: ''}
    }).state('charityDonation', {
        url: '/charityDonation',
        controller: 'donateController',
        templateUrl: 'app/donate/donate.html'
    }).state('charityDonation.love', {
        views: {
            'donate-content': {
                templateUrl: 'app/donate/loveHeart.html'
            }
        }
    }).state('charityDonation.help', {
        views: {
            'donate-content': {
                templateUrl: 'app/donate/templeHelp.html'
            }
        }
    }).state('charityDonation.illness', {
        views: {
            'donate-content': {
                templateUrl: 'app/donate/bigIllness.html'
            }
        }
    }).state('mediaList', {
        url: '/mediaList/{articleType}',
        controller: 'mediaListController',
        templateUrl: 'app/media/medialist.html'
    }).state('mediaDetail', {
        url: '/mediaDetail/{id}',
        controller: 'mediaController',
        templateUrl: 'app/media/media.html'
    }).state('audit', {
        url: '/audit',
        templateUrl: 'app/audit/audit.html',
        controller: 'auditController'
    }).state('auditMore',{
        url:'/audit/{category}',
        controller:'auditMoreController',
        templateUrl:'app/audit/auditMore.html'
    })
    .state('tinyLove', {
        url: '/tinyLove',
        controller:'tinyLoveListController',
        templateUrl: 'app/tinyLove/tiny-love.html'
    }).state('happyLive', {
        url: '/happyLive',
        controller:'happyLiveListController',
        templateUrl: 'app/happyLive/happy-live.html'
    }).state('projectList', {
        url: '/project/list',
        controller: 'projectListController',
        templateUrl: 'app/project/project.list.html'
    }).state('projectContent', {
        url: '/project/content/{id}',
        controller: 'projectContentController',
        templateUrl: 'app/project/project.content.html'
    }).state('donation', {
        url: '/donation',
        controller: 'donationController',
        templateUrl: 'app/donation/donation.html'
    }).state('login', {
        url: '/login',
        templateUrl: 'app/user/login.html',
        controller: 'userLoginController'
    }).state('register', {
        url: '/register',
        templateUrl: 'app/user/register.html',
        controller: 'userRegisterController'
    }).state('resetPasswordByEmail', {
        url: '/resetPassword/email',
        templateUrl: 'app/resetPassword/email.html',
        controller: 'resetPasswordByEmailCtrl'
    }).state('setNewPasswordByEmail', {
        url: '/resetPassword/email/newPassword',
        templateUrl: 'app/resetPassword/email-password.html',
        controller: 'setNewPasswordByEmailCtrl'
    })
    .state('weixinpay', {
        url: '/weixinpay',
        templateUrl: 'app/weixinpay/pay-qrcode.html',
        controller: 'weixinpayController'
    }).state('paynotify', {
        url: '/paynotify',
        templateUrl: 'app/paynotify/pay-notify.html',
        controller: 'paynotifyController'
    });
}]).config(['cfpLoadingBarProvider', function (cfpLoadingBarProvider) {
    // http请求进度条, 屏蔽加载中 angularjs-loading-bar
    cfpLoadingBarProvider.includeSpinner = false;
}]).run([function () {

}]);